package com.hdaccp.foodsales.controller;

import com.hdaccp.foodsales.service.MembersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/gks")
@Scope("prototype")
public class MembersController {

    @Autowired
    private MembersService membersService;


    @RequestMapping("/query")
    @ResponseBody
    public Map<String,Object> query(int offset, int limit){
       /* Map<String,Object> map = new HashMap<>() ;
        map.put("rows",userInfoService.findAll(offset,limit)) ;
        map.put("total",userInfoService.findTotalCount()) ;
        return  map ;*/

        return  null ;
    }



    @RequestMapping("/querySearch")
    @ResponseBody
    public Map<String,Object> querySearch(String membersname, int offset, int limit){
        Map<String,Object> map = new HashMap<String,Object>() ;
        map.put("rows",membersService.findAll(membersname,offset,limit)) ;
        map.put("total",membersService.findTotalCount(membersname)) ;
        return  map ;
    }

    @RequestMapping("/Search")
    @ResponseBody
    public Map<String,Object> Search(String membersname,int offset, int limit){
        Map<String,Object> map = new HashMap<String,Object>() ;
        map.put("rows",membersService.user(membersname,offset,limit)) ;
        map.put("total",membersService.findTotalCount(membersname)) ;
        return  map ;
    }
}
